﻿Imports IControl.IControls

Public Class IFormDoiBK
    Private iclass As IClass = New IClass
    Private ds As DataSet
    Private dt, dt1, dt2, dt3, dt4, dt5, dt6, dt7, dt8, dt9, dt10 As DataTable
    Private bd, bd1, bd2, bd3, bd4, bd5, bd6, bd7, bd8, bd9, bd10 As BindingSource
    Private am, ad As Object
    Private state As Integer
    Private controlFocus As Control
    Private SoTab As Integer 'số tab sử dụng
    Private flag As Boolean = True
    Public Overridable Sub setSubTruoc_Luu()
    End Sub
    Public Overridable Sub setSubSau_Luu()
    End Sub
    Public Overridable Sub setSubTruoc_TaoMoi()
    End Sub
    Public Overridable Sub setSubSau_TaoMoi()
    End Sub
    Public Overridable Sub setSubTruoc_Sua()
    End Sub
    Public Overridable Sub setSubSau_Sua()
    End Sub
    Public Overridable Sub setSubTruoc_Xoa()
    End Sub
    Public Overridable Sub setSubSau_Xoa()
    End Sub
    Public Overridable Sub setSubTruoc_HuyThayDoi()
    End Sub
    Public Overridable Sub setSubSau_HuyThayDoi()
    End Sub
    Public Overridable Sub setSubTruoc_In()
    End Sub
    Public Overridable Sub setSubSau_In()
    End Sub
    Public Overridable Sub setSubTruoc_Thoat()
    End Sub
    Public Overridable Sub setSubTruoc_LamTuoi()
    End Sub
    Public Overridable Sub setSubSau_LamTuoi()
    End Sub
    Public Overridable Sub setSubTruoc_DauTien()
    End Sub
    Public Overridable Sub setSubSau_DauTien()
    End Sub
    Public Overridable Sub setSubTruoc_Truoc()
    End Sub
    Public Overridable Sub setSubSau_Truoc()
    End Sub
    Public Overridable Sub setSubTruoc_Sau()
    End Sub
    Public Overridable Sub setSubSau_Sau()
    End Sub
    Public Overridable Sub setSubTruoc_Cuoi()
    End Sub
    Public Overridable Sub setSubSau_Cuoi()
    End Sub
    '=====================================================
    Public Overridable Function setFuncTruoc_Luu() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_Luu() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_TaoMoi() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_TaoMoi() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_Sua() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_Sua() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_HuyThayDoi() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_Xoa() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_Xoa() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_HuyThayDoi() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_In() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_in() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_Thoat() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_LamTuoi() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_LamTuoi() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_DauTien() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_DauTien() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_Truoc() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_Truoc() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_Sau() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_Sau() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncTruoc_Cuoi() As Boolean
        Return True
    End Function
    Public Overridable Function setFuncSau_Cuoi() As Boolean
        Return True
    End Function
    '=========== set tab đối tượng ===========
    'truong hop form doi
    Public Sub setTab1(ByVal dt1 As DataTable, ByVal bd1 As BindingSource, ByVal ad1 As Object, ByVal igridview1 As IGridView)
        Me.dt1 = dt1
        Me.bd1 = bd1
        Me.iclass.addTab1(dt1, bd1, ad1, igridview1)
    End Sub
    Public Sub setTab2(ByVal dt2 As DataTable, ByVal bd2 As BindingSource, ByVal ad2 As Object, ByVal igridview2 As IGridView)
        Me.dt2 = dt2
        Me.bd2 = bd2
        Me.iclass.addTab1(dt2, bd2, ad2, igridview2)
    End Sub
    Public Sub setTab3(ByVal dt3 As DataTable, ByVal bd3 As BindingSource, ByVal ad3 As Object, ByVal igridview3 As IGridView)
        Me.dt3 = dt3
        Me.bd3 = bd3
        Me.iclass.addTab1(dt3, bd3, ad3, igridview3)
    End Sub
    Public Sub setTab4(ByVal dt4 As DataTable, ByVal bd4 As BindingSource, ByVal ad4 As Object, ByVal igridview4 As IGridView)
        Me.dt4 = dt4
        Me.bd4 = bd4
        Me.iclass.addTab1(dt4, bd4, ad4, igridview4)
    End Sub
    Public Sub setTab5(ByVal dt5 As DataTable, ByVal bd5 As BindingSource, ByVal ad5 As Object, ByVal igridview5 As IGridView)
        Me.dt5 = dt5
        Me.bd5 = bd5
        Me.iclass.addTab1(dt5, bd5, ad5, igridview5)
    End Sub
    Public Sub setTab6(ByVal dt6 As DataTable, ByVal bd6 As BindingSource, ByVal ad6 As Object, ByVal igridview6 As IGridView)
        Me.dt6 = dt6
        Me.bd6 = bd6
        Me.iclass.addTab1(dt6, bd6, ad6, igridview6)
    End Sub
    '=========== end set tab đối tượng =======
    ''' <summary>
    ''' set các đối tượng của form đơn
    ''' </summary>
    ''' <param name="ds">Tên DataSet</param>
    ''' <param name="dt">Tên Datatable</param>
    ''' <param name="bd">Tên BidingSource</param>
    ''' <param name="am">Tên TableAdapterManager</param>
    ''' <param name="igridview">Tên IGridView</param>
    ''' <param name="controlfocus">Tên control bắt focus khi tạo mới</param>
    ''' <remarks></remarks>
    Public Sub setObjDb(ByVal ds As DataSet, ByVal dt As DataTable, ByVal bd As BindingSource, ByVal am As Object, ByVal ad As Object, ByVal igridview As IGridView, ByVal controlfocus As Control)
        Me.bd = bd
        Me.ds = ds
        Me.dt = dt
        Me.am = am
        Me.ad = ad
        Me.IGridView1 = igridview
        Me.controlFocus = controlfocus
        iclass.setObj(ds, dt, bd, am, ad, igridview, controlfocus)
    End Sub
    Public Function getKiemTraMaTonTai(ByVal sMa As String) As Boolean 'kiểm tra sự tồn tại của mã - dùng kiểm tra chung với igridview
        If Me.bd.Find("ma", sMa) = -1 Then 'nếu -1 nghĩa là ko tìm đc vị trí trong bindingsource
            Return False
        Else 'còn lại là tìm đc vị trí --> đã tồn tại
            Return True
        End If
    End Function
    Private Sub setReadonlyControl(ByVal b As Boolean)
        setReadonly(Me.LayoutControl1, b)
        If b Then
            Try
                Me.IGridView1.OptionsBehavior.Editable = False
                Me.IGridView1.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None
                Me.IGridViewDs1.setLock(False)
            Catch ex As Exception
            End Try
        Else
            Try
                Me.IGridView1.OptionsBehavior.Editable = True
                Me.IGridView1.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom
                Me.IGridViewDs1.setLock(True)
            Catch ex As Exception
            End Try
        End If
        If b Then
            Me.DxValidationProvider1.ValidationMode = DevExpress.XtraEditors.DXErrorProvider.ValidationMode.Manual
            setButtonTrangThaiSua(False)
        Else
            Me.DxValidationProvider1.ValidationMode = DevExpress.XtraEditors.DXErrorProvider.ValidationMode.Auto
            setButtonTrangThaiSua(True)
        End If
    End Sub
    Private Sub setButtonTrangThaiSua(ByVal b As Boolean) 'set nút lưu và xóa - khi ở trạng thái sửa thì mới cho phép thao tác trên nó (enable = true) - các trạng thái khác thì không cho (enable = false)
        Me.BarButtonItemLuu.Enabled = b
        Me.BarButtonItemXoa.Enabled = b
        If b Then 'xử lý nút sửa (nếu nút lưu - xóa cho phép thì sửa ko cho phép và ngược lại)
            Me.BarButtonItemTaoMoi.Enabled = False
            Me.BarButtonItemSua.Enabled = False
        Else
            Me.BarButtonItemTaoMoi.Enabled = True
            Me.BarButtonItemSua.Enabled = True
        End If
    End Sub
    Private Sub BarButtonItemTaoMoi_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemTaoMoi.ItemClick
        Me.setSubTruoc_TaoMoi()
        If Me.setFuncTruoc_TaoMoi() Then
            If state = 1 Then
                If getKiemTraMaTonTai(controlFocus.Text) Then
                    DevExpress.XtraEditors.XtraMessageBox.Show("'" & controlFocus.Text & "' đã tồn tại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    Me.controlFocus.Focus()
                    Exit Sub
                End If
            End If
            Me.setReadonlyControl(False)
            If iclass.getNew() Then
                Me.controlFocus.Focus()
                Me.state = 1
                Me.setSubSau_TaoMoi()
            End If
        End If
    End Sub
    Private Sub BarButtonItemLuu_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemLuu.ItemClick
        Me.setSubTruoc_Luu()
        If Me.setFuncTruoc_Luu Then
            IGridView1.setUpdateData()
            IGridView2.setUpdateData()
            IGridView3.setUpdateData()
            IGridView4.setUpdateData()
            IGridView5.setUpdateData()
            IGridView6.setUpdateData()
            If Not IsNothing(bd1) Then
                Me.bd1.EndEdit()
            End If
            If Not IsNothing(bd2) Then
                Me.bd2.EndEdit()
            End If
            If Not IsNothing(bd3) Then
                Me.bd3.EndEdit()
            End If
            If Not IsNothing(bd4) Then
                Me.bd4.EndEdit()
            End If
            If Not IsNothing(bd5) Then
                Me.bd5.EndEdit()
            End If
            If Not IsNothing(bd6) Then
                Me.bd6.EndEdit()
            End If
            If iclass.getSave() And state <> 0 Then
                setReadonlyControl(True)
                Me.state = 0
                Me.flag = True
                Me.setSubSau_Luu()
            End If
        End If
    End Sub
    Private Sub BarButtonItemSua_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemSua.ItemClick
        Me.setSubTruoc_Sua()
        If Me.setFuncTruoc_Sua() Then
            setReadonlyControl(False)
            state = 2
            Me.setSubSau_Sua()
        End If
    End Sub
    Private Sub BarButtonItemXoa_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemXoa.ItemClick
        Me.setSubTruoc_Xoa()
        If Me.setFuncTruoc_Xoa Then
            If Me.iclass.getDelete() Then
                setReadonlyControl(True)
                Me.state = 0
                Me.setSubSau_Xoa()
            End If
        End If
    End Sub
    Private Sub BarButtonItemLamTuoi_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemLamTuoi.ItemClick
        Me.setSubTruoc_LamTuoi()
        If Me.setFuncTruoc_LamTuoi Then
            If Me.iclass.getRefresh() Then
                setReadonlyControl(True)
                Me.state = 0
                Me.setSubSau_LamTuoi()
            End If
        End If
    End Sub
    Private Sub BarButtonItemBaoCao_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemBaoCao.ItemClick
        Me.setSubTruoc_In()
        If Me.setFuncTruoc_In Then
            Me.setSubSau_In()
        End If
    End Sub
    Private Sub BarButtonItemHuyThayDoi_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemHuyThayDoi.ItemClick
        Me.setSubTruoc_HuyThayDoi()
        If Me.setFuncTruoc_HuyThayDoi Then
            If Me.iclass.getUndo() Then
                setReadonlyControl(True)
                Me.state = 0
                Me.setSubSau_HuyThayDoi()
            End If
        End If
    End Sub
    Private Sub BarButtonItemFirst_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemFirst.ItemClick
        Me.setSubTruoc_DauTien()
        If Me.setFuncTruoc_DauTien Then
            Me.iclass.getMoveFirst()
            Me.setSubSau_DauTien()
        End If
    End Sub
    Private Sub BarButtonItemPrevious_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemPrevious.ItemClick
        Me.setSubTruoc_Truoc()
        If Me.setFuncTruoc_Truoc Then
            Me.iclass.getMovePrevious()
            Me.setSubSau_Truoc()
        End If
    End Sub
    Private Sub BarButtonItemNext_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemNext.ItemClick
        Me.setSubTruoc_Sau()
        If Me.setFuncTruoc_Sau Then
            Me.iclass.getMoveNext()
            Me.setSubSau_Sau()
        End If
    End Sub
    Private Sub BarButtonItemLast_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemLast.ItemClick
        Me.setSubTruoc_Cuoi()
        If Me.setFuncTruoc_Cuoi Then
            Me.iclass.getMoveLast()
            Me.setSubSau_Cuoi()
        End If
    End Sub
    Private Sub BarButtonItemThoat_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemThoat.ItemClick
        Me.setSubTruoc_Thoat()
        If Me.setFuncTruoc_Thoat Then
            Me.Dispose()
            Me.Close()
        End If
    End Sub

    Private Sub IFormDon_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Me.setSubTruoc_Thoat()
        If Me.setFuncTruoc_Thoat Then
            Me.Dispose()
            Me.Close()
        End If
    End Sub
    Private Sub FormDon1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        setReadonlyControl(True)
    End Sub

    Private Sub BarButtonItemTaoMoiChiTiet_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemTaoMoiChiTiet.ItemClick
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 0 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                Me.IGridView1.setFocusDongDauTien()
            End If
        End If
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 1 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                Me.IGridView2.setFocusDongDauTien()
            End If
        End If
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 2 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                Me.IGridView3.setFocusDongDauTien()
            End If
        End If
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 3 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                Me.IGridView4.setFocusDongDauTien()
            End If
        End If
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 4 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                Me.IGridView5.setFocusDongDauTien()
            End If
        End If
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 5 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                Me.IGridView6.setFocusDongDauTien()
            End If
        End If
    End Sub
    Public Sub setSoTab(ByVal số_tab_sử_dụng As Integer)
        Me.SoTab = số_tab_sử_dụng
        'Me.TabbedControlGroupChiTiet.TabPages(1).HideToCustomization()
        If SoTab = 1 Then
            Me.LayoutControlGroup02.HideToCustomization()
            Me.LayoutControlGroup03.HideToCustomization()
            Me.LayoutControlGroup04.HideToCustomization()
            Me.LayoutControlGroup05.HideToCustomization()
            Me.LayoutControlGroup06.HideToCustomization()
            Me.LayoutControlGroupDs3.HideToCustomization()
            Me.LayoutControlGroupDs4.HideToCustomization()
            Me.LayoutControlGroupDs5.HideToCustomization()
            Me.LayoutControlGroupDs6.HideToCustomization()
            Me.LayoutControlGroupDs7.HideToCustomization()
        End If
        If SoTab = 2 Then
            Me.LayoutControlGroup03.HideToCustomization()
            Me.LayoutControlGroup04.HideToCustomization()
            Me.LayoutControlGroup05.HideToCustomization()
            Me.LayoutControlGroup06.HideToCustomization()
            Me.LayoutControlGroupDs4.HideToCustomization()
            Me.LayoutControlGroupDs5.HideToCustomization()
            Me.LayoutControlGroupDs6.HideToCustomization()
            Me.LayoutControlGroupDs7.HideToCustomization()
        End If
        If SoTab = 3 Then
            Me.LayoutControlGroup04.HideToCustomization()
            Me.LayoutControlGroup05.HideToCustomization()
            Me.LayoutControlGroup06.HideToCustomization()
            Me.LayoutControlGroupDs5.HideToCustomization()
            Me.LayoutControlGroupDs6.HideToCustomization()
            Me.LayoutControlGroupDs7.HideToCustomization()
        End If
        If SoTab = 4 Then
            Me.LayoutControlGroup05.HideToCustomization()
            Me.LayoutControlGroup06.HideToCustomization()
            Me.LayoutControlGroupDs6.HideToCustomization()
            Me.LayoutControlGroupDs7.HideToCustomization()
        End If
        If SoTab = 5 Then
            Me.LayoutControlGroup06.HideToCustomization()
            Me.LayoutControlGroupDs7.HideToCustomization()
        End If
    End Sub
    Public Function getState() As Integer
        Return state
    End Function

    Private Sub BarButtonItemXoaChiTiet_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemXoaChiTiet.ItemClick
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 0 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                If DevExpress.XtraEditors.XtraMessageBox.Show("Bạn có muốn xóa '" & Me.IGridView1.GetRowCellValue(Me.IGridView1.FocusedRowHandle, IGridView1.VisibleColumns(0)) & "' không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then
                    Me.IGridView1.DeleteRow(Me.IGridView1.FocusedRowHandle)
                    Me.IGridView1.UpdateCurrentRow()
                    Me.IGridView1.UpdateGroupSummary()
                    Me.IGridView1.UpdateSummary()
                End If
            End If
        End If
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 1 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                If DevExpress.XtraEditors.XtraMessageBox.Show("Bạn có muốn xóa '" & Me.IGridView2.GetRowCellValue(Me.IGridView2.FocusedRowHandle, IGridView2.VisibleColumns(0)) & "' không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then
                    Me.IGridView2.DeleteRow(Me.IGridView2.FocusedRowHandle)
                    Me.IGridView2.UpdateCurrentRow()
                    Me.IGridView2.UpdateGroupSummary()
                    Me.IGridView2.UpdateSummary()
                End If
            End If
        End If
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 2 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                If DevExpress.XtraEditors.XtraMessageBox.Show("Bạn có muốn xóa '" & Me.IGridView3.GetRowCellValue(Me.IGridView3.FocusedRowHandle, IGridView3.VisibleColumns(0)) & "' không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then
                    Me.IGridView3.DeleteRow(Me.IGridView3.FocusedRowHandle)
                    Me.IGridView3.UpdateCurrentRow()
                    Me.IGridView3.UpdateGroupSummary()
                    Me.IGridView3.UpdateSummary()
                End If
            End If
        End If
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 3 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                If DevExpress.XtraEditors.XtraMessageBox.Show("Bạn có muốn xóa '" & Me.IGridView4.GetRowCellValue(Me.IGridView4.FocusedRowHandle, IGridView4.VisibleColumns(0)) & "' không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then
                    Me.IGridView4.DeleteRow(Me.IGridView4.FocusedRowHandle)
                    Me.IGridView4.UpdateCurrentRow()
                    Me.IGridView4.UpdateGroupSummary()
                    Me.IGridView4.UpdateSummary()
                End If
            End If
        End If
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 4 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                If DevExpress.XtraEditors.XtraMessageBox.Show("Bạn có muốn xóa '" & Me.IGridView5.GetRowCellValue(Me.IGridView5.FocusedRowHandle, IGridView5.VisibleColumns(0)) & "' không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then
                    Me.IGridView5.DeleteRow(Me.IGridView5.FocusedRowHandle)
                    Me.IGridView5.UpdateCurrentRow()
                    Me.IGridView5.UpdateGroupSummary()
                    Me.IGridView5.UpdateSummary()
                End If
            End If
        End If
        If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex = 5 Then
            If Me.TabbedControlGroupChiTiet.SelectedTabPageIndex <= (Me.SoTab - 1) Then
                If DevExpress.XtraEditors.XtraMessageBox.Show("Bạn có muốn xóa '" & Me.IGridView6.GetRowCellValue(Me.IGridView6.FocusedRowHandle, IGridView6.VisibleColumns(0)) & "' không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then
                    Me.IGridView6.DeleteRow(Me.IGridView6.FocusedRowHandle)
                    Me.IGridView6.UpdateCurrentRow()
                    Me.IGridView6.UpdateGroupSummary()
                    Me.IGridView6.UpdateSummary()
                End If
            End If
        End If
    End Sub
    'Private Sub IGridView1_GotFocus(sender As Object, e As System.EventArgs) Handles IGridView1.GotFocus
    '    If Me.getState <> 0 And flag Then
    '        Me.bd.EndEdit()
    '        Me.IGridView1.setFocusDongDauTien()
    '        flag = False
    '    Else
    '        Exit Sub
    '    End If
    'End Sub

    Private Sub BarButtonItemHuyThayDoiChiTiet_ItemClick(sender As System.Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemHuyThayDoiChiTiet.ItemClick

    End Sub
End Class